#include<iostream.h>
#include<fstream>
using namespace std;
int main()
{
    ofstream file;
    file.open("generated.txt");
    int start, end, op;
    cout<<"Start generating at: ";
    cin>>start;
    cout<<"Stop generating at: ";
    cin>>end;
    cout<<"Select option to output as:"<<endl;
    cout<<"       1. Separated by line"<<endl;
    cout<<"       2. Separated by comma"<<endl;
    cout<<"       3. Separated by space"<<endl;
    cout<<"       4. Separated by tab"<<endl;
    cout<<"Choice: ";
    cin>>op;
    while(op<1 || op>4)
    {
        cout<<"Only an option 1-4. Pick again: ";
        cin>>op;
    }
    for(int x = start; x<=end; x++)
    {
        file<<x;
        if(op==1)
           file<<endl;
        else if(op==2)
        {
           if(x!=end)
               file<<", ";
        }
        else if(op==3)
           file<<" ";
        else if(op==4)
           file<<"    ";
    }
    file.close();
    cout<<"Done. Check file.";
    cin.get();
    cin.get();  
    return 0;
}